package com.bainaeco.framework.util;

import org.apache.commons.lang3.StringUtils;

import com.bainaeco.framework.exception.InvalidArgumentException;

/**
 * 参数验证
 * 
 */
public class AssertUtil {

	public static void notNull(Object obj, String message) {
		assertTrue(obj != null, message);
	}

	public static void notEmpty(String str, String message) {
		assertTrue(StringUtils.isNotEmpty(str), message);
	}

	public static void notBlank(String str, String message) {
		assertTrue(StringUtils.isNotBlank(str), message);
	}

	public static void assertTrue(boolean flag, String message) {
		if (!flag) {
			throw new InvalidArgumentException(message);
		}
	}

}
